<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

require dirname(__FILE__).'/pc_controller.php';

require_once dirname(__FILE__).'/menu.php';

class Hd_game_lottery_history extends PC_controller {

    public function __construct(){
        parent::__construct();
        $this->load->model('Hdcustomermodel','m_customer');
    }

    public function index(){
        $data = parent::index();

        global $g_hd_game_gift;
        $data['game_gift'] = array4js($g_hd_game_gift);

        $this->load->view('admin/hd_game_lottery_history',$data);
    }

    public function getLotteryHistoryList() {
        $assist['where'] = getFilter($this->input->post(),Hdcustomermodel::$historySearchField);
        $assist['like'] = getFilter($this->input->post(),Hdcustomermodel::$historyLikeField);
        $assist['pagination'] = getPagination($this->input->post());

        if(isset($assist['where']['hd_game_lottery_history.gift_type']) && $assist['where']['hd_game_lottery_history.gift_type'] < 0) {
            unset($assist['where']['hd_game_lottery_history.gift_type']);
            $assist['where']['hd_game_lottery_history.gift_type >'] ='0';
        }

        $assist['select'] = '
            hd_game_customer.customer_id,
            hd_game_customer.nickname,
            hd_game_lottery_history.*
        ';
        list($list,$count) = $this->m_customer->getLotteryHistoryListSection($assist);

        foreach ($list as $key => $value) {
            $list[$key]['nickname'] = urldecode($value['nickname']);
        }

        $this->response->setSuccess();
        $this->response->setItems($list);
        $this->response->setTotalCount($count);
        $this->response->responseExit();
    }

}
/* End of file aa_game_history.php */
/* Location: ./application/controllers/aa_game_history.php */